package day05home;

/*扩展练习 定义数组，包含10个元素，随机生成数据(范围自拟)，查找最大值和最小值，并输出

 */
public class ArrayMaxMin {
    public static void main(String[] args) {
        int[] arr = new int[6];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random() * 100);
            System.out.println(arr[i]);
        }
        int max = arr[0];
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        System.out.println("最大值是" + max + "最小值是" + min);

    }
}
